package com.example.my.agiftthat.ui.classify.adapter;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.example.my.agiftthat.R;
import com.example.my.agiftthat.helper.RecyclerViewAdapterHelper;
import com.example.my.agiftthat.ui.classify.bean.ColumnBean;
import com.example.my.agiftthat.ui.classify.bean.ThreeBean;

import java.util.List;

/**
 * Created by My on 2016/12/21.
 */

public class ClassRecyclerAdapter extends RecyclerViewAdapterHelper<ThreeBean.DataBean.ChannelGroupsBean.ChannelsBean> {
    private Intent intent=null;
    private String url;
    private int id;
    public ClassRecyclerAdapter(Context context, List<ThreeBean.DataBean.ChannelGroupsBean.ChannelsBean> list) {
        super(context, list);
    }

    @Override
    public RecyclerView.ViewHolder onCreateMyViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.item_strategy_three, null);
        return new ViewHolder1(view);
    }

    @Override
    public void onBindMyViewHolder(RecyclerView.ViewHolder holder, final int position) {
        if (holder instanceof ViewHolder1) {
            Glide.with(context).load(list.get(position).getCover_image_url()).into(((ViewHolder1) holder).imageView_class);
        }
//        holder.itemView.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                intent=new Intent(context, ClickActivity.class);
//                url=list.get(position).getUrl();
//                id=list.get(position).getColumn().getId();
//                intent.putExtra("url", url);
//                intent.putExtra("id", id);
//                context.startActivity(intent);
//            }
//        });
    }

    class ViewHolder1 extends RecyclerView.ViewHolder {
        private ImageView imageView_class;

        public ViewHolder1(View itemView) {
            super(itemView);
            imageView_class = (ImageView) itemView.findViewById(R.id.imageView_cover_image);
        }
    }
}